package history.double_exam;

public class LeetCode_5743 {
    public static void main(String[] args) {
        System.out.println(memLeak(8,11));
    }
    public static int[] memLeak(int memory1, int memory2) {
        if (memory1 <0 || memory2 < 0) return new int[0];
        int time = 1;
        while (Math.max(memory1, memory2) >= time) {
            if (memory1 >= memory2) {
                memory1 -= time;
            } else {
                memory2 -= time;
            }
            time++;
        }
        return new int[]{time, memory1, memory2};
    }
}
